package net.togogo;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ForwardServlet extends HttpServlet {

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("ForwardServlet----->doGET方法被调用");
        //小明同学拿着学生证去部门A窗口申请奖学金
        String name = request.getParameter("name");
        System.out.println(name + ":同学在部门A窗口提交材料;");
        //部门A窗口给小明同学写了个证明
        request.setAttribute("key1","在A窗口获得证明,上面有确认章");
        //小明同学拿着证明去B窗口核销
        RequestDispatcher requestDispatcher = request.getRequestDispatcher("/forward2");
        requestDispatcher.forward(request, response);
    }
}
